The invention relates to handling parameters in block diagram modeling.
Dynamic systems may be modeled, simulated and analyzed on a computer system using graphical block diagram modeling tools, e.g., Simulink® from The MathWorks Inc. Graphical block diagram modeling graphically depicts mathematical relationships among a system's inputs, states, parameters, and outputs, typically through the use of graphical user interface.
In a graphical context, a block diagram is a directed graph containing nodes and arcs providing a means by which the nodes can communicate. In most block diagramming paradigms, the nodes are referred to as blocks and drawn using some for of geometric object (e.g., circle, rectangle, etc.) and the arcs are typically drawn using line segments connecting the geometric objects. These line segments are often referred to as signals. For example, some Simulink® block diagrams enable the user to model dynamic systems where each block represents a functional entity that mathematical operations and transformations on the data (variables) being processed by a system and therefore implements a set of equations. The signals represent a time-varying quantity that is updated, i.e., read-by and written-to, by the blocks. Within Simulink®, blocks execute using a predetermined ordering and with control-flow semantics. Other types of graphical block diagrams include data-flow block diagrams wherein blocks wait for data to be valid before they execute.
Within Simulink®, executing a graphical block diagram model refers to solving the equations defined by the nodes in the directed graph. The order of execution of the nodes is dictated by the direction of the arcs that connect the nodes. Graphs with strongly connected components (i.e., nodes that form cycles) can be executed by solving each cycle simultaneously as a coupled set of equations.
In theory, there can be a number of equations (often referred to as block methods) that are associated with a block. For example, Simulink® supports various types of block methods. One such block method is an output method, expressed in the form ofy=OutputMethod(t,x,u,p)where y is typically a set of block output signals (or some other forms of output, e.g., a logging device such as a plotting tool or a data archiving block), t is time, x represents a set of continuous states and discrete states, u represents the set of input signals to the block and p represents a set of parameters supplied to the block.
A user can parameterize a block with user-defined values by specifying the parameters p that are to be used by the block. For example, Simulink® allows a user to specify block parameters through a dialog box or programmatically via a ‘set_param’ command.
As indicated earlier, a parameter can take on a wide variety of attributes. In addition, a parameter can be defined as an expression. For example, for a gain block that has an output method y=p*u, where p represents a single parameter, a user could define the parameter p as a numeric quantity (e.g., 1:10), an expression of variables and functions, e.g., a*b+sin(c), or a combination of the two.
Using the equations defined by the blocks, block diagrams can be executed in an interpreted environment that produces a simulation result as defined by the blocks and signals in the model. In addition, code can be generated from the block diagrams and executed in an executive. The executive is often referred to as an execution framework for the generated code. It is responsible for executing the generated code by calling the entry points in the generated code at the right times.